package com.renjian.funplaypro.controllers;

import com.renjian.funplaypro.model.ShareMsg;
import com.renjian.funplaypro.services.ShareMsgService;
import com.renjian.funplaypro.utils.CommonResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

@RestController
@CrossOrigin
public class ShareMsgController {
    @Resource
    ShareMsgService shareMsgService;
    /**
     * @author renjian
     * @description 用户发送动态
     * @param msg
     * @return
     */
    @PostMapping("/share_msg/send_msg")
    public Object sendShareMsg(@RequestBody ShareMsg msg){
        msg.setCreateTime(new Date());
        shareMsgService.save(msg);
        return new CommonResult().success("博客发布成功!");
    }
}
